<template>
  <el-dialog
    :title="title"
    :visible.sync="dialogVisible"
    width="50%"
    @close="handleClose"
  >
    <el-form :model="formData" label-width="120px">
		<el-form-item label="教室ID">
		  <el-input v-model="formData.classroomEquipmentId"></el-input>
		</el-form-item>
		<el-form-item label="设备基础ID">
		  <el-input v-model="formData.equipmentBasicId"></el-input>
		</el-form-item>
      <el-form-item label="教室名称">
        <el-input v-model="formData.classroomName"></el-input>
      </el-form-item>
      <el-form-item label="设备编号">
        <el-input v-model="formData.classroomEquipmentNo"></el-input>
      </el-form-item>
      <el-form-item label="设备位置">
        <el-input v-model="formData.classroomEquipmentLocation"></el-input>
      </el-form-item>
      <el-form-item label="设备容量">
        <el-input v-model="formData.classroomEquipmentCapacity"></el-input>
      </el-form-item>
      <el-form-item label="使用说明">
        <el-input v-model="formData.classroomInstructions"></el-input>
      </el-form-item>
      <el-form-item label="备注">
        <el-input v-model="formData.remark"></el-input>
      </el-form-item>
	  <el-form-item label="节点">
	    <el-input v-model="formData.sortIndex"></el-input>
	  </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="handleClose">取 消</el-button>
      <el-button type="primary" @click="submitForm">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  props: {
    form: Object,
    title: String,
    editDialogVisible: Boolean,
    isEdit: Boolean
  },
  data() {
    return {
      dialogVisible: this.editDialogVisible,
      formData: { ...this.form }
    };
  },
  watch: {
    editDialogVisible(val) {
      this.dialogVisible = val;
      if (val) {
        this.formData = { ...this.form };
      }
    },
    form(val) {
      this.formData = { ...val };
    }
  },
  methods: {
    handleClose() {
      this.$emit('update:editDialogVisible', false);
    },
    submitForm() {
      this.$emit('save', this.formData);
    }
  }
};
</script>

<style scoped>
</style>